var t = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../@babel/runtime/helpers/defineProperty")), a = require("../../services/api.js");

Page({
    data: {
        tabs: [ "未核销", "已核销" ],
        value: "",
        active: 0,
        pageNum: [ 1, 1 ],
        pageTotal: [ 0, 0 ],
        lists: Array(2).fill([])
    },
    onLoad: function(t) {},
    nInput: function(t) {
        this.setData({
            value: t.detail.value
        });
    },
    seach: function() {
        var t = this;
        0 !== this.data.value.trim().length ? (wx.showLoading({
            title: "查询中"
        }), setTimeout(function() {
            wx.hideLoading(), wx.navigateTo({
                url: "/pages/verfiyOrder/index?id=".concat(t.data.value)
            });
        })) : wx.showModal({
            title: "提示",
            content: "请输入核销单号",
            showCancel: !1
        });
    },
    scanCode: function() {
        var t = this;
        wx.scanCode({
            success: function(a) {
                a.result && t.setData({
                    value: a.result
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {
        this.getLists();
    },
    getLists: function() {
        var e = this, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, i = this.data.active, o = {
            page: n,
            pageSize: 8,
            verify_status: i
        };
        (0, a.getVerfyList)(o).then(function(a) {
            if (200 === a.data.code) {
                var o, s = a.data.data.list || a.data.data;
                e.setData((o = {}, (0, t.default)(o, "lists[".concat(i, "]"), n > 1 ? [].concat(e.data.lists[i], s) : s), 
                (0, t.default)(o, "pageTotal[".concat(i, "]"), a.data.data.count), (0, t.default)(o, "pageNum[".concat(i, "]"), n), 
                o));
            }
        });
    },
    tabChangeHandle: function(t) {
        var a = this;
        this.setData({
            active: t.detail.current
        }, function() {
            a.getLists();
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        wx.stopPullDownRefresh(), this.onShow();
    },
    onReachBottom: function() {
        var t = this.selectComponent("#pagination");
        if (!t) return !1;
        var a = t.hasMore();
        a && this.getLists(a);
    }
});